<?php
include_once('include/Config.php');

Class TipoDocumentoDAL {

    private $link;

    function __construct() {
        $this->conectar();
    }

    function conectar() {
        
        //Tomado del config.php 
        $this->link = $GLOBALS["DBConnPDO"];
        
    }

    function comboTipoDocumento() {
        $query = "SELECT idTipoDocumento, descripcion FROM tipodocumento";
        foreach ($this->link->query($query) as $row) {
            $result = '';

            foreach ($this->link->query($query) as $row) {
                $result .= $row['idTipoDocumento'] . ':' . $row['descripcion'] . ';';
            }
        }
        
        return $result;
    }

    function comboTipoDocumentoHTML() {
        $query = "SELECT idTipoDocumento, descripcion FROM tipodocumento";
        $result = '';

        foreach ($this->link->query($query) as $row) {
            $result .= '<OPTION VALUE="' . $row['idTipoDocumento'] . '">' . $row['descripcion'] . '</OPTION>';
        }
        
        return $result;
    }

}

?>
